<template>
  <div class="admin-production-list">
    <w-nav-search-bar
      @change="topBarClick"
      @search="searckBtnClick"
      :class-model="classModel"/>
    <w-cell
      v-for="(v, k) in loadListModel.dataArr"
      :key="k"
      :item="v"
      @reload="reloadData"/>
    <!--底部加载更多-->
    <w-load-more :load-model="loadListModel"/>
  </div>
</template>

<script>
/*作品*/
import ProductModel from '@/models/web/ProductModel'
import WLoadMore from '@/components/global/loadMore/index'
import YBListLoad from '@/models/YBListLoad'
import WCell from './cell'
import WNavSearchBar from '@/pages/pc/com/nav/typeAndSelKey'
export default {
  name: 'WebWorks',
  components: {
    WLoadMore,
    WCell,
    WNavSearchBar
  },
  data() {
    return {
      /**
       * 列表加载模型
       */
      loadListModel: new YBListLoad(ProductModel, { type: '' }),
      /**
       * 类模型
       */
      classModel: ProductModel,
    }
  },
  methods: {
    /**
     * 顶部导航栏点击
     * @param e
     */
    topBarClick(e) {
      const key = e.label === '全部' ? '' : e.label
      this.loadListModel.otherData = { type: key }
      this.reloadData()
    },
    /**
     * 重新加载数据
     */
    reloadData() {
      this.loadListModel.clearData()
      this.loadListModel.loadData()
    },
    /**
     * 查找按钮点击
     * @param type 查找类型
     * @param key 查找的关键字
     */
    searckBtnClick(key) {
      this.loadListModel.otherData.searchKey = key
      this.reloadData()
    }
  }
}
</script>

<style>

</style>
